package org.nepu.srr.设备设施本体风险.承压试验;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nepu.sc.domain.DataVO;


@Data
@ApiModel(value = "承压实验参数")
public class B21EnduringPressureParams {
    @ApiModelProperty(value = "环形防喷器试压(合格/不合格)")
    DataVO circularTrapTest;

    @ApiModelProperty(value = "闸板防喷器试压及相应控制设备试压(合格/不合格)")
    DataVO valveTrapTest;

    @ApiModelProperty(value = "阻流压井管线及闸阀试压(合格/不合格)")
    DataVO flowValveTest;

    @ApiModelProperty(value = "内防喷工具试压(合格/不合格)")
    DataVO internalTrapTest;

    public B21EnduringPressureResult rate(){
        double fullScore = 40;
        double rateScore = 0;

        if (circularTrapTest.getData().equals("合格")){
            rateScore += 10;
        }
        if (valveTrapTest.getData().equals("合格")){
            rateScore += 10;
        }
        if (flowValveTest.getData().equals("合格")){
            rateScore += 10;
        }
        if (internalTrapTest.getData().equals("合格")){
            rateScore += 10;
        }

        double score = rateScore / fullScore;
        B21EnduringPressureResult result = new B21EnduringPressureResult();
        result.setRateScore(score);
        if (score >= 0.6){
            result.setRateResult("安全");
        }
        return result;
    }
}
